/*
 * Created by 岱青海蓝信息系统(北京)有限公司 on 17-2-17 下午5:42
 * Copyright (c) 2017. All rights reserved.
 */

package com.example.dqhl.recycleviewdemo.adapter;

import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentManager;
import android.support.v4.app.FragmentPagerAdapter;

import java.util.ArrayList;

/**
 * Created by dqhl on 17/2/17.
 */
public class MyPageAdapter extends FragmentPagerAdapter {

    private ArrayList<Fragment> mFragments = new ArrayList<>();
    private String[] mTitles;

    public MyPageAdapter(FragmentManager fm,ArrayList<Fragment> mFragments,String[] mTitles) {
        super(fm);
        this.mFragments = mFragments;
        this.mTitles = mTitles;
    }

    @Override
    public Fragment getItem(int position) {
        return mFragments.get(position);
    }

    @Override
    public CharSequence getPageTitle(int position) {
        return mTitles[position];

    }

    @Override
    public int getCount() {
        return mFragments.size();
    }
}
